<?php

namespace App\Kuafu\Shop\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;
use App\Kuafu\Base\Model\Traits\KfUid;

class SourceMaterialTemplateModel extends BaseModel
{
    use  KfSoftDeletes, KfUid;

    protected $connection  = 'mysql';
    protected $table       = 'source_material_template';
    protected $fillable    = [
        'id',
        'name',
        'url',
        'reverseUrl',
        'reverseThumbnail',
        'thumbnail',
        'value',
        'type',
        'size',
        'sort',
        'appValue',
        'isDeleted',
        'createdAt',
        'updatedAt',
        'createdByUid',
        'updatedByUid',
    ];

    const TEMPLATE_IMG_TYPE_UPRIGHT = 1;
    const TEMPLATE_IMG_TYPE_REVERSE = 2;

    const TEMPLATE_IMG_TYPE_TEXT = [
        self::TEMPLATE_IMG_TYPE_UPRIGHT => "正面",
        self::TEMPLATE_IMG_TYPE_REVERSE => "背面",
    ];

    //素材类型 1：开业活动免费吃 2 ：开业活动进店送 3 ：招聘海报 4 ：好评卡外卖海报 5:开业必备 6:夸父新品物料 7:产品分享图 8:电视机广告屏
    const TEMPLATE_TYPE_OPENING_ACTIVITIES_FREE    = 1;
    const TEMPLATE_TYPE_OPENING_ACTIVITIES_IN_SHOP = 2;
    const TEMPLATE_TYPE_RECRUITMENT_POSTER         = 3;
    const TEMPLATE_TYPE_PRAISE_CARD                = 4;
    const TEMPLATE_TYPE_OPEN_SHOP                  = 5;
    const TEMPLATE_TYPE_NEW_MATERIAL               = 6;
    const TEMPLATE_TYPE_PRODUCT_SHARING_IMG        = 7;
    const TEMPLATE_TYPE_TV_AD                      = 8;
    const TEMPLATE_TYPE_NO                         = 9;// 素材 目前没使用
    const TEMPLATE_TYPE_OPEN_ACTIVITY              = 10;// 开业活动
    const TEMPLATE_TYPE_PRIVATE_ACTIVITY           = 11;// 私域活动

    const TEMPLATE_TYPE_TEXT = [
        self::TEMPLATE_TYPE_PRAISE_CARD                => "好评卡",
        self::TEMPLATE_TYPE_OPENING_ACTIVITIES_FREE    => "开业活动免费吃",
        self::TEMPLATE_TYPE_OPENING_ACTIVITIES_IN_SHOP => "开业活动进店送",
        self::TEMPLATE_TYPE_RECRUITMENT_POSTER         => "招聘海报",
        self::TEMPLATE_TYPE_OPEN_SHOP                  => "开业必备",
        self::TEMPLATE_TYPE_NEW_MATERIAL               => "夸父新品物料",
        self::TEMPLATE_TYPE_PRODUCT_SHARING_IMG        => "产品分享图",
        self::TEMPLATE_TYPE_TV_AD                      => "电视机广告屏",
    ];

    const TEMPLATE_HOT_AREA_PRICE                    = 'price';
    const TEMPLATE_HOT_AREA_TEL                      = 'tel';
    const TEMPLATE_HOT_AREA_QRCODE                   = 'qrCode';
    const TEMPLATE_HOT_AREA_ENTERPRISE_QRCODE        = 'enterpriseQrCode';
    const TEMPLATE_HOT_AREA_RECRUITMENT_TITLE        = 'recruitmentTitle';
    const TEMPLATE_HOT_AREA_RECRUITMENT_REQUIRE      = 'recruitmentRequire';
    const TEMPLATE_HOT_AREA_RECRUITMENT_SHOP_ADDRESS = 'recruitmentShopAddress';

    const TEMPLATE_HOT_AREA_TEXT = [
        self::TEMPLATE_HOT_AREA_PRICE                    => "金额文字",
        self::TEMPLATE_HOT_AREA_TEL                      => "联系电话文字",
        self::TEMPLATE_HOT_AREA_QRCODE                   => "微信二维码",
        self::TEMPLATE_HOT_AREA_ENTERPRISE_QRCODE        => "企业微信二维码",
        self::TEMPLATE_HOT_AREA_RECRUITMENT_TITLE        => "招聘标题文字",
        self::TEMPLATE_HOT_AREA_RECRUITMENT_REQUIRE      => "招聘要求文字",
        self::TEMPLATE_HOT_AREA_RECRUITMENT_SHOP_ADDRESS => "招聘门店地址文字",
    ];

    public static function getInfoById(int $id)
    {
        return self::query()->find($id);
    }
}
